package GUI;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import ControlLayer.OrderCtr;
import javax.swing.JLabel;
public class OrderMaker extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6628746440837551470L;
	private JPanel contentPane;
	private JTextField DSField;
	private JTextField DDField;
	private JTextField DField;
	private JTextField QField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					OrderMaker frame = new OrderMaker();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public OrderMaker() {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(null);
		setContentPane(contentPane);
		
		JButton btnLavOrder = new JButton("lav order");
		btnLavOrder.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				createOrder(evt);
			}
		});
		btnLavOrder.setBounds(278, 215, 97, 25);
		contentPane.add(btnLavOrder);
		
		JLabel lblDate = new JLabel("Date");
		lblDate.setBounds(30, 30, 56, 16);
		contentPane.add(lblDate);
		
		JLabel lblAfleveringsdato = new JLabel("AfleveringsDato");
		lblAfleveringsdato.setBounds(30, 59, 97, 16);
		contentPane.add(lblAfleveringsdato);
		
		JLabel lblAfleveringsstatus = new JLabel("AfleveringsStatus");
		lblAfleveringsstatus.setBounds(30, 88, 108, 16);
		contentPane.add(lblAfleveringsstatus);
		
		DSField = new JTextField();
		DSField.setBounds(133, 85, 116, 22);
		contentPane.add(DSField);
		DSField.setColumns(10);
		
		DDField = new JTextField();
		DDField.setBounds(133, 56, 116, 22);
		contentPane.add(DDField);
		DDField.setColumns(10);
		
		DField = new JTextField();
		DField.setBounds(133, 27, 116, 22);
		contentPane.add(DField);
		DField.setColumns(10);
		
		JLabel lblAntal = new JLabel("Antal");
		lblAntal.setBounds(30, 151, 56, 16);
		contentPane.add(lblAntal);
		
		QField = new JTextField();
		QField.setBounds(133, 148, 116, 22);
		contentPane.add(QField);
		QField.setColumns(10);
		
		
	}
	private void createOrder(java.awt.event.ActionEvent make) {//GEN-FIRST:event_insertEmp
        OrderCtr oCtr = new OrderCtr();
  
        String date = DField.getText();
        String deliveryDate = DDField.getText();
        String deliveryStatus = DSField.getText();
        
       
            oCtr.insertNew(date, deliveryDate, deliveryStatus);
        
    }//GEN-LAST:event_insertEmp
}
